/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "orden_pago_sueldo_det", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrdenPagoSueldoDet.findAll", query = "SELECT o FROM OrdenPagoSueldoDet o"),
    @NamedQuery(name = "OrdenPagoSueldoDet.findByIdordenPago", query = "SELECT o FROM OrdenPagoSueldoDet o WHERE o.idordenPago = :idordenPago"),
    @NamedQuery(name = "OrdenPagoSueldoDet.findByMonto", query = "SELECT o FROM OrdenPagoSueldoDet o WHERE o.monto = :monto")})
public class OrdenPagoSueldoDet implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idorden_pago", nullable = false)
    private Integer idordenPago;
    @Column(name = "monto")
    private Integer monto;
    @JoinColumns({
        @JoinColumn(name = "ci_emp", referencedColumnName = "ci_emp", nullable = false),
        @JoinColumn(name = "idcargo", referencedColumnName = "idcargo", nullable = false),
        @JoinColumn(name = "idcontrato", referencedColumnName = "idcontrato", nullable = false),
        @JoinColumn(name = "idplanilla_pago", referencedColumnName = "idplanilla_pago", nullable = false),
        @JoinColumn(name = "planilla_pago_det_planilla_pago_fecha", referencedColumnName = "planilla_pago_fecha", nullable = false)})
    @ManyToOne(optional = false)
    private PlanillaPagoDet planillaPagoDet;
    @JoinColumn(name = "idorden_pago", referencedColumnName = "idorden_pago", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private OrdenPago ordenPago;

    public OrdenPagoSueldoDet() {
    }

    public OrdenPagoSueldoDet(Integer idordenPago) {
        this.idordenPago = idordenPago;
    }

    public Integer getIdordenPago() {
        return idordenPago;
    }

    public void setIdordenPago(Integer idordenPago) {
        this.idordenPago = idordenPago;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public PlanillaPagoDet getPlanillaPagoDet() {
        return planillaPagoDet;
    }

    public void setPlanillaPagoDet(PlanillaPagoDet planillaPagoDet) {
        this.planillaPagoDet = planillaPagoDet;
    }

    public OrdenPago getOrdenPago() {
        return ordenPago;
    }

    public void setOrdenPago(OrdenPago ordenPago) {
        this.ordenPago = ordenPago;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idordenPago != null ? idordenPago.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrdenPagoSueldoDet)) {
            return false;
        }
        OrdenPagoSueldoDet other = (OrdenPagoSueldoDet) object;
        if ((this.idordenPago == null && other.idordenPago != null) || (this.idordenPago != null && !this.idordenPago.equals(other.idordenPago))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.OrdenPagoSueldoDet[ idordenPago=" + idordenPago + " ]";
    }
    
}
